package com.fqy.ticket.generator.test;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
    public static void main(String[] args) {
        String str = "hello_world_example";
        String res = str.toLowerCase().replaceAll("_+", "_");

        // 处理下划线后的首字母大写
        Pattern pattern = Pattern.compile("_(\\w)");
        Matcher matcher = pattern.matcher(res);
        res = matcher.replaceAll(matchResult ->
                matchResult.group(1).toUpperCase()
        );

        System.out.println(res); // 输出：helloWorldExample
    }
}
